package pro.cherish.knowledgedemovalid.selfValid;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

public class OddValidator implements ConstraintValidator<OddValid,Integer> {

    @Override
    public boolean isValid(Integer value, ConstraintValidatorContext context) {

        if(value==null){
            return false;
        }
        Integer idNum=0;
        try {
            idNum= Integer.parseInt(value.toString());
        }catch (Exception e){
            return false;
        }
        if((int)value %2==0){
            return false;
        }
        return true;
    }
}
